<?php

namespace Common\Service;

use Think\Page;

class PageService {

  private static $instance;

  public static function instance() {
    if (self::$instance == null) {
      $instance = new PageService();
    }

    return $instance;
  }

  function html($page, $count, $page_size = 8) {
    $Pages = new Page($count, $page_size);
    //$_GET['p'] = $page;

    $Pages->setConfig('nowPage', $page);
    $Pages->setConfig('prev', '<span aria-hidden="true">&laquo;</span>');
    $Pages->setConfig('next', '<span aria-hidden="true">&raquo;</span>');
    $Pages->setConfig('theme', "<ul class='pagination pagination-sm'></li><li>%FIRST%</li><li>%UP_PAGE%</li><li>%LINK_PAGE%</li><li>%DOWN_PAGE%</li><li>%END%</li><li><a> %HEADER%  %NOW_PAGE%/%TOTAL_PAGE% 页</a></ul>");
    return $Pages->show(); // 分页显示输出
  }

  function bootstrap($page, $count, $page_size = 8) {
    $Pages = new Page($count, $page_size);
    //$_GET['p'] = $page;
    $Pages->setRollPage(2);
    $Pages->setNowPage($page);
    $Pages->setConfig('header', '人 , ');

    $Pages->setConfig('prev', "&laquo;");
    $Pages->setConfig('next', '&raquo;');
    $Pages->setConfig('theme', "<ul class='pagination'></li><li>%UP_PAGE%</li><li>%LINK_PAGE%</li><li>%DOWN_PAGE%</li><li><a> 共 %TOTAL_ROW% %HEADER%  %NOW_PAGE%/%TOTAL_PAGE% 页</a></ul>");
    return $Pages->show(); // 分页显示输出
  }

}
